flowbox: Always return a NULL iter when we are at the end
authorDebarshi Ray <debarshir@gnome.org>
Mon, 21 Oct 2013 14:32:49 +0000 (16:32 +0200)
committerDebarshi Ray <debarshir@gnome.org>
Mon, 21 Oct 2013 14:33:13 +0000 (16:33 +0200)
The objective is simplify the semantics of the code so that we don't
need to check for "(iter != NULL && !g_sequence_iter_is_end (iter))"
in the callers.

gtk/gtkflowbox.c

index 0bac89b3ae82086eac4e75a122a091a5baa6055e..f0ef7cce874c16feacb5fd81ea4b1f8354f140fd 100644 (file)
@@ -1198,7 +1198,7 @@ gtk_flow_box_get_next_focusable (GtkFlowBox    *box,
     {
       iter = g_sequence_iter_next (iter);
       if (g_sequence_iter_is_end (iter))
-        return iter;
+        return NULL;
       child = g_sequence_get (iter);
       if (child_is_visible (GTK_WIDGET (child)) &&
           gtk_widget_is_sensitive (GTK_WIDGET (child)))
@@ -1276,7 +1276,7 @@ gtk_flow_box_get_below_focusable (GtkFlowBox    *box,
         {
           iter = g_sequence_iter_next (iter);
           if (g_sequence_iter_is_end (iter))
-            return iter;
+            return NULL;
           child = g_sequence_get (iter);
           if (child_is_visible (GTK_WIDGET (child)))
             i++;
@@ -3200,7 +3200,7 @@ gtk_flow_box_focus (GtkWidget        *widget,
       else if (direction == GTK_DIR_DOWN)
         iter = gtk_flow_box_get_below_focusable (box, iter);
 
-      if (iter != NULL && !g_sequence_iter_is_end (iter))
+      if (iter != NULL)
         next_focus_child = g_sequence_get (iter);
     }
   else
@@ -3214,7 +3214,7 @@ gtk_flow_box_focus (GtkWidget        *widget,
           else
             iter = gtk_flow_box_get_first_focusable (box);
 
-          if (iter != NULL && !g_sequence_iter_is_end (iter))
+          if (iter != NULL)
             next_focus_child = g_sequence_get (iter);
         }
     }
@@ -3366,7 +3366,7 @@ gtk_flow_box_move_cursor (GtkFlowBox      *box,
         iter = gtk_flow_box_get_first_focusable (box);
       else
         iter = gtk_flow_box_get_last_focusable (box);
-      if (iter != NULL && !g_sequence_iter_is_end (iter))
+      if (iter != NULL)
         child = g_sequence_get (iter);
       break;
 
@@ -3386,7 +3386,7 @@ gtk_flow_box_move_cursor (GtkFlowBox      *box,
               count = count - 1;
             }
 
-          if (iter != NULL && !g_sequence_iter_is_end (iter))
+          if (iter != NULL)
             child = g_sequence_get (iter);
         }
       break;